﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using TimKen.BussLogic;

namespace TimKen.Web
{
    public partial class Culture : TimKen.App.WebPage
    {
        public List<string> imagepaths = new List<string>();
        public string Content;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        private void BindData()
        {
            DirectoryInfo dir = new DirectoryInfo(Server.MapPath(UploadFilePathForCulture));
            FileInfo[] finfo = dir.GetFiles();
            for (int i = 0; i < finfo.Length; i++)
            {
                string file = finfo[i].Name;

                if (file.EndsWith(".jpg") || file.EndsWith(".jpeg") || file.EndsWith(".gif") || file.EndsWith(".bmp"))
                    imagepaths.Add(UploadFilePathForCulture + file);
            }
            ArticleManager am = new ArticleManager();
            List<DataEntity.Article> articleList = am.GetModelList("  TypeID=5 AND LanguageID=" + LanguageID);
            if (articleList != null && articleList.Count > 0)
                Content = articleList[0].Content;
            else
                Content = string.Empty;
        }
    }
}